/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.bff.designtime.generator.entity.data;

import com.inspur.edp.bff.api.attribute.VMRootAttribute;
import com.inspur.edp.bff.designtime.generator.entity.VmEntityGenContext;
import com.inspur.edp.bff.designtime.generator.entity.detaillist.VoDetailListPropGenerator;
import com.inspur.edp.bff.designtime.generator.entity.node.VoNodeGeneratorContext;
import com.inspur.edp.caf.generator.baseInfo.AnnotationInfo;
import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
import com.inspur.edp.cef.entity.entity.IEntityData;
import com.inspur.edp.cef.generator.entityGenerator.entity.EntityNodeGeneratorContext;
import com.inspur.edp.cef.generator.entityGenerator.entity.entityData.DetailListPropGenerator;
import com.inspur.edp.cef.generator.entityGenerator.entity.entityData.EntityDataGenerator;
import com.inspur.edp.das.commonmodel.IGspCommonObject;

import java.util.ArrayList;

//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using DetailListPropGenerator = Inspur.Gsp.Cef.Generator.EntityGenerator.DetailListPropGenerator;

public class ExtendEntityDataGenerator extends EntityDataGenerator
{
	private IGspCommonObject currentNode;
	private VoNodeGeneratorContext parentContext;
	public ExtendEntityDataGenerator(IGspCommonObject node, VoNodeGeneratorContext parentContext)
	{
		super(parentContext, node);
		currentNode = node;
		this.parentContext = parentContext;
	}

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region Props
	//protected override List<BaseGenerator> CreatePropGenerators()
	//{
	//    var elements = ParentContext.ContainElements;
	//    var rez = new List<BaseGenerator>(elements.Count);
	//    foreach (var element in elements)
	//    {
	//        //if (element.IsRefering() || Equals(Node.IDElement, element))
	//        if (Equals(Node.IDElement, element))
	//            continue;
	//        rez.Add(new EntityDataPropGenerator(element, ParentContext));
	//    }
	//    return rez;
	//}

	//protected override DetailListPropGenerator CreateDetailListPropGenerator(IGspCommonObject node)
	//{
	//    return new Cef.Generator.EntityGenerator.ExtendDetailListPropGenerator(node, ParentContext.EntityGenContext);
	//}

	@Override
	protected DetailListPropGenerator getDetailPropGen(IGspCommonObject node, EntityNodeGeneratorContext nodeContext)
	{
		return new VoDetailListPropGenerator(node, (VoNodeGeneratorContext)((nodeContext instanceof VoNodeGeneratorContext) ? nodeContext : null));
	}

	@Override
	protected DetailListPropGenerator getDetailPropGen(IGspCommonObject node, EntityNodeGeneratorContext nodeContext, String nodeCode)
	{
		return new VoDetailListPropGenerator(node, (VoNodeGeneratorContext)((nodeContext instanceof VoNodeGeneratorContext) ? nodeContext : null), nodeCode);
	}

	@Override
	protected ArrayList<AnnotationInfo> getAttributeList() {
		if (currentNode.getID().equals(currentNode.getBelongModel().getMainObject().getID())==false)
		{
			return null;
		}
		if(parentContext.getEntityGenContext() instanceof  VmEntityGenContext)
		{
			addImport(VMRootAttribute.class.getTypeName());
			addImport(IEntityData.class.getTypeName());
			return ((VmEntityGenContext)parentContext.getEntityGenContext()).GetMainNodeAttributes(ast, currentNode);
		}


		String s="a";
switch (s)
{
	case "1":
		break;
}

		return null;

	}
}
